package cn.iocoder.an.module.mold.controller.admin.account.vo;

import cn.iocoder.an.module.mold.dal.dataobject.category.CategoryDO;
import cn.iocoder.an.module.mold.dal.dataobject.drawingno.DrawingNoDO;
import cn.iocoder.an.module.mold.dal.dataobject.linestopcategory.LinestopCategoryDO;
import cn.iocoder.an.module.mold.dal.dataobject.storage.StorageDO;
import cn.iocoder.an.module.mold.dal.dataobject.upkeepcategory.UpkeepCategoryDO;
import cn.iocoder.an.module.mold.dal.dataobject.warehouse.WarehouseDO;
import com.fhs.core.trans.anno.Trans;
import com.fhs.core.trans.constant.TransType;
import com.fhs.core.trans.vo.VO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import cn.idev.excel.annotation.*;
import cn.iocoder.an.framework.excel.core.annotations.DictFormat;
import cn.iocoder.an.framework.excel.core.convert.DictConvert;

@Schema(description = "管理后台 - 模具台账 Response VO")
@Data
@ExcelIgnoreUnannotated
public class AccountRespVO implements VO {

    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "11800")
    @ExcelProperty("主键")
    private Long id;

    @Schema(description = "模具名", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
    @ExcelProperty("模具名")
    private String name;

    @Schema(description = "编码", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("编码")
    private String code;

    @Schema(description = "图号id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6468")
    @Trans(type = TransType.SIMPLE, target = DrawingNoDO.class, fields = "drawingNo", ref = "drawingNo")
    private Long drawingNoId;

    @Schema(description = "图号")
    @ExcelProperty("图号")
    private String drawingNo;


    @Schema(description = "模具类型id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7480")
    @Trans(type = TransType.SIMPLE, target = CategoryDO.class, fields = "name", ref = "categoryName")
    private Long categoryId;

    @Schema(description = "模具类型")
    @ExcelProperty("模具类型")
    private String categoryName;

    @Schema(description = "客户名")
    @ExcelProperty("客户名")
    private String customer;

    @Schema(description = "部门Id", example = "30795")
    //@ExcelProperty("部门Id")
    @Trans(type = TransType.SIMPLE, targetClassName = "cn.iocoder.an.module.system.dal.dataobject.dept.DeptDO", fields = "name", ref = "deptName")
    private Long deptId;

    @Schema(description = "部门")
    @ExcelProperty("部门")
    private String deptName;

    @Schema(description = "设备Id", example = "15975")
    @Trans(type = TransType.SIMPLE, targetClassName = "cn.iocoder.an.module.business.dal.dataobject.equipmentmanage.EquipmentManageDO", fields = {"equipmentName","code","installPosition"}, refs = {"devName","devCode","devPosition"})
    private Long devId;

    @Schema(description = "设备名", example = "15975")
    @ExcelProperty("设备名")
    private String devName;

    @Schema(description = "设备编码", example = "15975")
    @ExcelProperty("设备编码")
    private String devCode;

    @Schema(description = "设备位置", example = "15975")
    @ExcelProperty("设备位置")
    private String devPosition;

    @Schema(description = "总腔数", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("总腔数")
    private Integer totalCavity;

    @Schema(description = "可用腔数")
    @ExcelProperty("可用腔数")
    private Integer availableCavity;

    @Schema(description = "寿命", requiredMode = Schema.RequiredMode.REQUIRED, example = "23601")
    @ExcelProperty("寿命")
    private Integer totalUsageCount;

    @Schema(description = "已使用", example = "26291")
    @ExcelProperty("已使用")
    private Integer usedCount;

    @Schema(description = "预警次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "24442")
    @ExcelProperty("预警次数")
    private Integer warningCount;

    @Schema(description = "延期次数", example = "31322")
    @ExcelProperty("延期次数")
    private Integer delayCount;

    @Schema(description = "描述", example = "你猜")
    @ExcelProperty("描述")
    private String description;

    @Schema(description = "仓库Id", example = "5197")
    @ExcelProperty("仓库Id")
    @Trans(type = TransType.SIMPLE, target = WarehouseDO.class, fields = "name", ref = "warehouseName")
    private Long warehouseId;

    @Schema(description = "仓库")
    @ExcelProperty("仓库")
    private String warehouseName;

    @Schema(description = "储位id", example = "10558")
    @ExcelProperty("储位id")
    @Trans(type = TransType.SIMPLE, target = StorageDO.class, fields = "name", ref = "storageName")
    private Long storageId;

    @Schema(description = "储位")
    @ExcelProperty("储位")
    private String storageName;

    @Schema(description = "bom类型", example = "22650")
    @ExcelProperty(value = "bom类型", converter = DictConvert.class)
    @DictFormat("mold_bom_category") // TODO 代码优化：建议设置到对应的 DictTypeConstants 枚举类中
    private String bomCategoryId;

    @Schema(description = "工步")
    @ExcelProperty("工步")
    private Integer oprationStep;

    @Schema(description = "数量")
    @ExcelProperty("数量")
    private Integer quantity;

    @Schema(description = "保养类型id", example = "25044")
    @Trans(type = TransType.SIMPLE, target = UpkeepCategoryDO.class, fields = {"name", "accountMethod", "upkeepPeriod"}, refs = {"upkeepCategory", "accountMethod", "upkeepPeriod"})
    private Long upkeepId;

    //保养分类
    @Schema(description = "保养分类", example = "工装保养")
    @ExcelProperty("保养分类")
    private String upkeepCategory;

    @Schema(description = "上次保养日期")
    @ExcelProperty("上次保养日期")
    private LocalDateTime lastUpkeepTime;

    @Schema(description = "下次保养日期")
    @ExcelProperty("下次保养日期")
    private LocalDateTime nextUpkeepTime;

    @Schema(description = "保养人id", example = "2384")
    @ExcelProperty("保养人id")
    private Long upkeeperId;

/*    @Schema(description = "保养日期")
    @ExcelProperty("保养日期")
    private LocalDateTime upkeepTime;*/

    @Schema(description = "复检类型id", example = "16858")
    @ExcelProperty("复检类型id")
    private Long recheckId;

    @Schema(description = "上次复检日期")
    @ExcelProperty("上次复检日期")
    private LocalDateTime lastRecheckTime;

    @Schema(description = "下次复检日期")
    @ExcelProperty("下次复检日期")
    private LocalDateTime nextRecheckTime;

    @Schema(description = "复检人id", example = "11260")
    @ExcelProperty("复检人id")
    private Long recheckerId;

/*    @Schema(description = "复检日期")
    @ExcelProperty("复检日期")
    private LocalDateTime recheckTime;*/

    @Schema(description = "领用人ID", example = "11159")
   // @ExcelProperty("领用人ID")
    @Trans(type = TransType.SIMPLE, targetClassName = "cn.iocoder.an.module.system.dal.dataobject.user.AdminUserDO", fields = "nickname", ref = "borrowerName")
    private Long borrowerId;

    @Schema(description = "领用人")
    @ExcelProperty("领用人")
    private String borrowerName;

    @Schema(description = "领用时间")
    @ExcelProperty("领用时间")
    private LocalDateTime borrowTime;

    @Schema(description = "归还人ID", example = "20302")
    @ExcelProperty("归还人ID")
    @Trans(type = TransType.SIMPLE, targetClassName = "cn.iocoder.an.module.system.dal.dataobject.user.AdminUserDO", fields = "nickname", ref = "returnerName")
    private Long returnerId;

    @Schema(description = "归还人")
    @ExcelProperty("归还人")
    private String returnerName;

    @Schema(description = "归还时间")
    @ExcelProperty("归还时间")
    private LocalDateTime returnTime;

    @Schema(description = "库存状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "in_stock")
    @ExcelProperty("库存状态")
    private String inventoryStatus;

    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("创建时间")
    private LocalDateTime createTime;

}
